package com.bjfu.demo.entity;

import java.util.HashMap;
import java.util.Map;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @create 2019-12-27 19:50
 */
@Data
@Accessors(chain = true)
public class RpResult {

    //状态码
    private int code;

    //消息
    private String msg;

    //数据
    private Map<String, Object> data=new HashMap<>();

    //正常返回
    public static RpResult ok() {
        RpResult rpResult = new RpResult();
        rpResult.setCode(200);
        return rpResult;
    }

    /**
     * 向data中添加数据
     *
     * @param key
     * @param value
     */
    public RpResult addData(String key, Object value) {
        data.put(key, value);
        return this;

    }


}
